{extend name="../../admin/view/main"}


{block name='content'}
<style>
    .radio-group {
        display: flex;
        flex-direction: row; /* 横向排列 */
        align-items: center; /* 垂直居中 */
        margin-top: 5px;
        margin-left: 5px;
    }

    .radio-item {
        display: flex;
        align-items: center;
        margin-right: 10px; /* 间距调整 */
    }

    .radio-item input[type="radio"] {
        margin-right: 5px; /* 与label的间距 */
    }

    #peipeiList > xm-select > .xm-body .xm-search {
        width: 77rem;
    }

    #peipeiList > xm-select > .xm-body .scroll-body {
        width: 77rem;
    }

    .layui-form-label {
        width: 100px;
    }

    .widthRem {
        width: 90% !important;
    }

    /*.layui-form-item .layui-input-inline {*/
    /*    width: 90%;*/
    /*}*/
</style>
<form action="{:sysuri()}" class="layui-card layui-form" data-auto="true" method="post">
    <div class="layui-card-body">

        <label class="layui-form-item relative block">
            <span class="help-label"><b>政策标题</b></span>
            <input class="layui-input" name="title" placeholder="请输入政策标题" required
                   value='{$vo.title|default=""}'>
        </label>





        <!--        <div class="layui-form-item layui-col-xs12">-->
        <!--            <span class="help-label" style="padding-right: 10px;"><b>企业注册资金范围</b></span>-->
        <!--            <input class="layui-input" name="qs_zczj" placeholder="起始资金" required value='{$vo.qs_zczj|default=""}'>-->
        <!--            <input class="layui-input" name="js_zczj" placeholder="结束资金" required value='{$vo.js_zczj|default=""}'>-->

        <!--        </div>-->

        <div class="layui-form-item layui-col-xs12" style="display: none">
            <span class="help-label" style="padding-right: 10px;"><b>文章类型</b></span>
            {if !empty($vo.wztype)}
            <input type="radio" name="wztype" lay-filter="wztype" value="1" title="政策公告" {if
                   $vo.wztype!=2}checked{/if}>
            <input type="radio" name="wztype" lay-filter="wztype" value="2" title="政策申报" {if
                   $vo.wztype==2}checked{/if}>
            {else}
            <input type="radio" name="wztype" lay-filter="wztype" value="1" title="政策公告" checked>
            <input type="radio" name="wztype" lay-filter="wztype" value="2" title="政策申报">
            {/if}

        </div>

        <div class="layui-form-item">
            <div class="layui-row">

                <div class="layui-col-xs3">
                    <span class="help-label"><b><span style="color: red">*</span>企业匹配标签</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div id="peipeiList" class="xm-select-demo"></div>
                    <input type="hidden" name="qybq" id="qybq" required value="{$vo.qybq|default=''}">
                </div>


                <div class="layui-col-xs3">
                    <span class="help-label"><b><span style="color: red">*</span>政策类别</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div id="policyTypeList" class="xm-select-demo"></div>
                    <input type="hidden" name="wzfl" id="wzfl" value="{$vo.wzfl|default=''}">
                </div>



                <div class="layui-col-xs3" style="padding-right: 5px">
                    <span class="help-label"><b><span style="color: red">*</span>政策层级</b></span>
                    <select class="layui-select" lay-filter="level_id" required name="level_id" lay-search>
                        <option value="">-- 请选择 --</option>
                        {if !empty($vo.level_id)}
                        {foreach $level_list as $k=>$v}
                        <!-- {if $v.id eq $vo.level_id} -->
                        <option selected value="{$v.id}">{$v.name|default="无"}</option>
                        <!-- {else} -->
                        <option value="{$v.id}">{$v.name|default="无"}</option>
                        <!-- {/if} -->
                        {/foreach}
                        {else}
                        {foreach $level_list as $k=>$v}
                        <option value="{$v.id}">{$v.name|default="无"}</option>
                        {/foreach}
                        {/if}
                    </select>
                </div>
                <div class="layui-col-xs3" style="padding-right: 5px;display:none;">
                    <span class="help-label"><b><span style="color: red">*</span>事项分类</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div id="matterTypeList" class="xm-select-demo"></div>
                    <input type="hidden" name="matter_type_id" id="matter-type" value="{$vo.matter_type_id|default=''}">
                </div>
                <div class="layui-col-xs3" style="padding-right: 5px;display:none">
                    <label class="layui-form-item relative block">
                        <span class="help-label"><b>事项类型</b></span>
                        <input class="layui-input" name="event_type" placeholder="请输入事项类型" required
                               value='{$vo.event_type|default=""}'>
                    </label>
                </div>
                <div class="layui-col-xs3">
                    <label class="layui-form-item block">
                        <span class="help-label"><b>适用行业</b></span>
                        <input class="layui-input" name="industry" placeholder="请输入适用行业"
                               value='{$vo.industry|default=""}'>
                    </label>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-xs3" style="padding-right: 5px">
                    <label class="layui-form-item block">
                        <span class="help-label"><b>适用对象</b></span>
                        <input class="layui-input" name="applicable" placeholder="请输入适用对象"
                               value='{$vo.applicable|default=""}'>
                    </label>
                </div>
                <div class="layui-col-xs3" style="padding-right: 5px">
                    <label class="layui-form-item relative block">
                        <span class="help-label"><b>联系人</b></span>
                        <input class="layui-input" name="contact" placeholder="请输入联系人" required
                               value='{$vo.contact|default=""}'>
                    </label>
                </div>
                <div class="layui-col-xs3" style="padding-right: 5px">
                    <label class="layui-form-item relative block">
                        <span class="help-label"><b>联系方式</b></span>
                        <input class="layui-input" name="contact_information" placeholder="请输入联系方式" required
                               value='{$vo.contact_information|default=""}'>
                    </label>
                </div>
                <div class="layui-col-xs3">
                    <label class="help-label relative block">
                        <span class="help-label"><b>出台日期</b></span>
                        <input type="text" class="layui-input" name="ctrq" id="ctrq" required value="{$vo.ctrq|default=''}"
                               placeholder="请选择出台日期">
                    </label>

                </div>
            </div>
        </div>


        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-xs3" style="padding-right: 5px">
                    <label class="help-label"><b>申报开始日期</b></label>
                    <input type="text" class="layui-input" name="sbksrq" id="sbksrq"
                           value="{$vo.sbksrq|default=''}"
                           placeholder="请选择申报开始日期">
                </div>
                <div class="layui-col-xs3" style="padding-right: 5px">
                    <label class="help-label"><b>申报截止类型</b></label>
                    <div class="radio-group">
                        <div class="radio-item">
                            <input class="layui-input" type="radio" name="riqitype" lay-filter="riqitype" value="1"
                                   title="短期"
                                   {if ($vo.riqitype ?? 1) !=2}checked{/if}>
                        </div>
                        <div class="radio-item">
                            <input class="layui-input" type="radio" name="riqitype" lay-filter="riqitype" value="2"
                                   title="长期"
                                   {if ($vo.riqitype ?? 1)==2}checked{/if}>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs3" style="padding-right: 5px">
                    <label class="help-label"><b>申报截止日期</b></label>
                    <input type="text" class="layui-input" name="sbjzrq" id="sbjzrq"
                           value="{$vo.sbjzrq|default=''}"
                           placeholder="请选择申报截止日期">
                </div>
                <div class="layui-col-xs3">
                    <label class="layui-form-item block">
                        <span class="help-label"><b>办理地点</b></span>
                        <input class="layui-input" name="address" placeholder="请输入办理地点"
                               value='{$vo.address|default=""}'>
                    </label>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-xs3" style="padding-right: 5px;display: none">
                    <laber class="help-label" style="padding-right: 10px;"><b>开始办理日期</b></laber>
                    <input type="text" class="layui-input" name="time_start" id="time_start"
                           value="{$vo.time_start|default=''}" placeholder="请选择开始办理日期">
                </div>
                <div class="layui-col-xs3" style="padding-right: 5px;display: none">
                    <span class="help-label" style="padding-right: 10px;"><b>截止办理类型</b></span>
                    <div class="radio-group">
                        <div class="radio-item">
                            <input type="radio" name="long_term" lay-filter="long_term" value="0" title="短期" {if
                                   ($vo.long_term ?? 0)!=1}checked{/if}>
                        </div>
                        <div class="radio-item">
                            <input type="radio" name="long_term" lay-filter="long_term" value="1" title="长期" {if
                                   ($vo.long_term ?? 0)==1}checked{/if}>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs3" style="padding-right: 5px;display: none">
                    <label class="help-label"><b>申报截止办理日期</b></label>
                    <input type="text" class="layui-input" name="time_end" id="time_end"
                           value="{$vo.time_end|default=''}"
                           placeholder="请选择截止办理日期">
                </div>
                <div class="layui-col-xs3">
                    <label class="help-label relative"><b>发布部门</b>
                        <input class="layui-input" name="fbdw" placeholder="请输入发布部门" required
                               value='{$vo.fbdw|default=""}'>
                    </label>

                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-xs3" style="padding-right: 5px;display: none">
                    <label class="help-label"><b>是否为金融政策</b></label>
                    <div class="radio-group">
                        <div class="radio-item">
                            <input class="layui-input" type="radio" name="is_financial" lay-filter="riqitype" value="0"
                                   title="否"
                                   {if ($vo.is_financial ?? 0)==0}checked{/if}>
                        </div>
                        <div class="radio-item">
                            <input class="layui-input" type="radio" name="is_financial" lay-filter="riqitype" value="1"
                                   title=是
                                   {if ($vo.is_financial ?? 1)!=0}checked{/if}>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="hr-line-dashed"></div>
        <div class="layui-form-item" id="content-div">
            <span class="help-label"><b>政策摘要</b></span>
            <div class="relative block">
                <textarea class="layui-hide" name="content"
                          placeholder="请输入政策摘要">{$vo.content|default=''}</textarea>
            </div>
        </div>


        <div class="layui-form-item " id="zcyw-div" style="">
            <span class="help-label"><b>政策原文</b></span>
            <div class="relative block">
                <textarea class="layui-hide" name="zcyw" placeholder="请输入政策原文">{$vo.zcyw|default=''}</textarea>
            </div>
        </div>

        <div class="layui-form-item " id="sbzn-div" style="display: none">
            <span class="help-label"><b>办理流程</b></span>
            <div class="relative block">
                <textarea class="layui-hide" name="sbzn" placeholder="请输入办理流程">{$vo.sbzn|default=''}</textarea>
            </div>
        </div>


        <div class="layui-form-item" style="display: none">
            <span class="help-label"><b>政策文件</b></span>
            <div class="relative block label-required-null">
                <input class="layui-input think-bg-gray" name="wenjian_url" placeholder="请上传政策文件" readonly
                       value='{$vo.wenjian_url|default=""}'>
<!--                <a class="layui-icon layui-icon-upload input-right-icon" data-file="one" data-field="wenjian_url"-->
<!--                   data-type="docx,TXT,txt,doc,pptx,xlsx,xls,pdf"></a>-->
                <a class="layui-icon layui-icon-upload input-right-icon" data-file="one" data-field="wenjian_url"
                   data-type="pdf"></a>
            </div>
        </div>

        <div class="hr-line-dashed"></div>

        <div class="layui-form-item" style="display: none">
            <h2>政策匹配信息</h2>
            <br>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>企业类型</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="enterpriseTypeList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.enterprise_type" id="enterprise-type-list"
                           value="{$vo.extension.enterprise_type|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>行业分类</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="industryClassificationList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.industry_classification" id="industry-classification"
                           value="{$vo.extension.industry_classification|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>企业规模</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="enterpriseScaleList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.enterprise_scale" id="enterprise-scale"
                           value="{$vo.extension.enterprise_scale|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>企业营收</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="corporateRevenueList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.corporate_revenue" id="corporate-revenue"
                           value="{$vo.extension.corporate_revenue|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>纳税等级</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="taxBracketList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.tax_bracket" id="tax-bracket"
                           value="{$vo.extension.tax_bracket|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>用工人数</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="workersNumberList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.workers_number" id="workers-number"
                           value="{$vo.extension.workers_number|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>研发投入占比</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="developProportionList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.develop_proportion" id="develop-proportion"
                           value="{$vo.extension.develop_proportion|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>发明专利数量</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="patentNumberList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.patent_number" id="patent-number"
                           value="{$vo.extension.patent_number|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>软著数量</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="softQuantityList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.soft_quantity" id="soft-quantity"
                           value="{$vo.extension.soft_quantity|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>技术资质</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="technicalQualificationsList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.technical_qualifications" id="technical-qualifications"
                           value="{$vo.extension.technical_qualifications|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <span class="layui-form-label" style="color: #098"><b>产业链角色</b></span>
                    <span class="color-desc margin-left-5"></span>
                    <div class="layui-input-inline widthRem">
                        <div id="industrialChainRoleList" class="xm-select-demo"></div>
                    </div>
                    <input type="hidden" name="extension.industrial_chain_role" id="industrial-chain-role"
                           value="{$vo.extension.industrial_chain_role|default=''}">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <label class="layui-form-label" style="color: #098"><b>成立年限</b></label>
                    <div class="layui-input-inline" style="width: 250px">
                        <div class="radio-group">
                            <div class="radio-item">
                                <input type="radio" name="year" lay-filter="year" value="1" title="限制年限" {if
                                       ($vo.extension.year ?? 2)==1}checked{/if}>
                            </div>
                            <div class="radio-item">
                                <input type="radio" name="year" lay-filter="year" value="2" title="不限年限" {if
                                       ($vo.extension.year ?? 2)!=1}checked{/if}>
                            </div>
                        </div>
                    </div>
                    <div class="layui-input-inline">
                        <select lay-filter="year_start" id="year_start" class="layui-select" name="extension.year_start"
                                lay-search>
                            <option value="">开始年限</option>
                            <!-- 动态生成年份选项 -->
                        </select>
                    </div>
                    <div class="layui-input-inline" style="width: 5px; text-align: center; padding-top: 5px;">
                        <span>-</span>
                    </div>
                    <div class="layui-input-inline">
                        <select lay-filter="year_end" id="year_end" class="layui-select" name="extension.year_end"
                                lay-search>
                            <option value="">结束年限</option>
                        </select>
                    </div>
                </div>
            </div>

        </div>


        {notempty name='vo.id'}<input name='id' type='hidden' value='{$vo.id}'>{/notempty}

        <div class="layui-form-item text-center">
            <button class="layui-btn" type="submit">保存数据</button>
            <button class="layui-btn layui-btn-danger" data-history-back data-confirm="确定要取消编辑吗？" type='button'>
                取消编辑
            </button>
        </div>
    </div>

</form>
<script>
    layui.use(function () {
        let laydate = layui.laydate;
        // 渲染
        laydate.render({
            elem: '#ctrq'
        });
        laydate.render({
            elem: '#sbjzrq'
        });
        laydate.render({
            elem: '#sbksrq'
        });
        laydate.render({
            elem: '#time_start'
        });
        laydate.render({
            elem: '#time_end'
        });
    });
</script>

<script>
    $(document).ready(function () {
        let selectedValue = $('input[name="riqitype"]:checked').val();
        if (selectedValue === "2") {
            $('#sbjzrq').prop('disabled', true);
        }
    });

    $(document).ready(function () {
        let selectedValue = $('input[name="long_term"]:checked').val();
        if (selectedValue === "1") {
            $('#long_term').prop('disabled', true);
        }
    });

    $(document).ready(function () {
        let selectedValue = $('input[name="year"]:checked').val();
        if (selectedValue === "1") {
            $('#year').prop('disabled', true);
        }
    });


    //监听事件
    layui.form.on('radio(wztype)', function (data) {

        if (data.value === "1") {
            $('#content-div').show();
            $('#zcyw-div').hide();
            $('#sbzn-div').hide();
        } else if (data.value === "2") {
            $('#content-div').hide();
            $('#zcyw-div').show();
            $('#sbzn-div').show();
        }
    });

    //监听事件
    layui.form.on('radio(riqitype)', function (data) {
        if (data.value === "1") {
            $('#sbjzrq').prop('disabled', false);
        } else if (data.value === "2") {
            $('#sbjzrq').prop('disabled', true);
        }
    });


    //监听事件
    layui.form.on('radio(long_term)', function (data) {
        if (data.value === "0") {
            $('#time_end').prop('disabled', false);
        } else if (data.value === "1") {
            $('#time_end').prop('disabled', true);
        }
    });

    //监听事件
    layui.form.on('radio(year)', function (data) {
        if (data.value === "2") {
            $('#year_start').prop('disabled', true);
            $('#year_end').prop('disabled', true);
            // 查找所有具有特定类名的div元素
            var inputInlineDivs = $('.layui-input-inline');

            // 遍历每个div元素
            inputInlineDivs.each(function () {
                // 在当前div中查找具有特定类名的子div
                var selectTitleDiv = $(this).find('.layui-select-title');

                // 在子div中查找input元素并禁用
                selectTitleDiv.find('input').prop('disabled', true);
            });
        } else {
            $('#year_start').prop('disabled', false);
            $('#year_end').prop('disabled', false);
            // 查找所有具有特定类名的div元素
            var inputInlineDivs = $('.layui-input-inline');

            // 遍历每个div元素
            inputInlineDivs.each(function () {
                // 在当前div中查找具有特定类名的子div
                var selectTitleDiv = $(this).find('.layui-select-title');
                // 在子div中查找input元素并禁用
                selectTitleDiv.find('input').prop('disabled', false);
            });
        }
    });

    layui.use(['form', 'jquery'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        // 动态生成年份选项
        for (let i = 1; i <= 30; i++) {
            $('#year_start').append($('<option>', {
                value: i,
                text: i
            }));
            $('#year_end').append($('<option>', {
                value: i,
                text: i
            }));
        }
        // 重新渲染表单
        form.render();
    });

</script>

<script>
    require(['ckeditor'], function () {
        window.createEditor('[name=content]', {height: 350})
        window.createEditor('[name=zcyw]', {height: 350})
        window.createEditor('[name=sbzn]', {height: 350})
    });

    $(function () {
        let extension = [];
        getUserList();
        getAllType();
        getMatterType();
        getExtendedType()
            .then(data => {
                extension = data;
                //渲染政策匹配信息
                //企业类型
                enterpriseType(extension.enterprise_type);
                // 行业分类
                industry_classification(extension.industry_classification)
                //企业规模
                enterprise_scale(extension.enterprise_scale)
                // 企业营收
                corporate_revenue(extension.corporate_revenue)
                // 纳税等级
                tax_bracket(extension.tax_bracket)
                // 用工人数
                workers_number(extension.workers_number)
                // 研发投入占比
                develop_proportion(extension.develop_proportion)
                // 发明专利数量
                patent_number(extension.patent_number)
                // 软著数量
                soft_quantity(extension.soft_quantity)
                // 技术资格
                technical_qualifications(extension.technical_qualifications)
                // 产业链角色
                industrial_chain_role(extension.industrial_chain_role)
                // 成立年限
                // 'establishment_period'
            })
            .catch(err => {
                console.error("Failed to fetch extension type data:", err);
            });
    });

    //企业标签
    function getUserList() {
        layui.use('xmSelect', function () {
            //企业标签
            $.ajax({
                type: 'get',
                url: "{:url('getQybqList')}",
                data: "",
                dataType: "json",
                success: function (res) {
                    if (res.code) {
                        let datas = [];
                        res.data.forEach(function (item) {
                            let uuid = "{$vo.qybq|default=''}".split(',');
                            if (uuid.length && uuid.findIndex(it => it == item.id) != -1) {
                                datas.push({name: item.name, value: item.id, selected: true});

                            } else {
                                datas.push({name: item.name, value: item.id});
                            }
                        });
                        xmSelect.render({
                            el: '#peipeiList',
                            tips: '请选择企业标签',//选项提示文字
                            autoRow: true,//自动换行
                            width: '80rem',
                            filterable: true,//搜索模式
                            data: datas,
                            on: function (data) {
                                let selectArr = data.arr;
                                let seachArr = [];
                                for (let j = 0; j < selectArr.length; j++) {
                                    seachArr.push(selectArr[j].value)
                                }
                                $("#qybq").val(seachArr.toString());
                            }
                        })
                    } else {
                    }
                },
                error: function (err) {
                }
            });
        });
    }

    //所属分类
    function getAllType() {
        layui.use('xmSelect', function () {
            //所属分类
            $.ajax({
                type: 'get',
                url: "{:url('getPolicyTypeList')}",
                data: "",
                dataType: "json",
                success: function (res) {
                    if (res.code) {
                        let datas = [];
                        res.data.forEach(function (item) {
                            let uuid = "{$vo.wzfl|default=''}".split(',');
                            if (uuid.length && uuid.findIndex(it => it == item.id) != -1) {
                                datas.push({name: item.name, value: item.id, selected: true});

                            } else {
                                datas.push({name: item.name, value: item.id});
                            }
                        });
                        xmSelect.render({
                            el: '#policyTypeList',
                            tips: '请选择所属分类',//选项提示文字
                            filterable: true,//搜索模式
                            data: datas,
                            on: function (data) {
                                let selectArr = data.arr;
                                let seachArr = [];
                                for (let j = 0; j < selectArr.length; j++) {
                                    seachArr.push(selectArr[j].value)
                                }
                                $("#wzfl").val(seachArr.toString());
                            }
                        })
                    } else {
                    }
                },
                error: function (err) {
                }
            });
        });
    }

    //事项分类
    function getMatterType() {
        layui.use('xmSelect', function () {
            $.ajax({
                type: 'get',
                url: "{:url('getMatterTypeList')}",
                data: "",
                dataType: "json",
                success: function (res) {
                    if (res.code) {
                        let datas = [];
                        res.data.forEach(function (item) {
                            let uuid = "{$vo.matter_type_id|default=''}".split(',');
                            if (uuid.length && uuid.findIndex(it => it == item.id) != -1) {
                                datas.push({name: item.matter_name, value: item.id, selected: true});

                            } else {
                                datas.push({name: item.matter_name, value: item.id});
                            }
                        });
                        xmSelect.render({
                            el: '#matterTypeList',
                            tips: '请选择所属分类',//选项提示文字
                            filterable: true,//搜索模式
                            data: datas,
                            on: function (data) {
                                let selectArr = data.arr;
                                let seachArr = [];
                                for (let j = 0; j < selectArr.length; j++) {
                                    seachArr.push(selectArr[j].value)
                                }
                                $("#matter-type").val(seachArr.toString());
                            }
                        })
                    } else {
                    }
                },
                error: function (err) {
                }
            });
        });
    }

    // 获取政策匹配信息
    function getExtendedType() {
        return new Promise((resolve, reject) => {
            $.ajax({
                type: 'get',
                url: "{:url('getExtendedType')}", // 确保这里的URL是正确的
                data: "",
                dataType: "json",
                success: function (res) {
                    resolve(res.data); // 成功时调用 resolve
                },
                error: function (err) {
                    reject(err); // 失败时调用 reject
                }
            });
        });
    }

    //企业类型
    function enterpriseType(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.enterprise_type|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#enterpriseTypeList',
                tips: '请选择企业类型',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#enterprise-type-list").val(seachArr.toString());
                }
            })
        });
    }

    //行业分类
    function industry_classification(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.industry_classification|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#industryClassificationList',
                tips: '请选择行业分类',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#industry-classification").val(seachArr.toString());
                }
            })
        });
    }

    //企业规模
    function enterprise_scale(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.enterprise_scale|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#enterpriseScaleList',
                tips: '请选择企业规模',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#enterprise-scale").val(seachArr.toString());
                }
            })
        });
    }

    //企业营收
    function corporate_revenue(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.corporate_revenue|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#corporateRevenueList',
                tips: '请选择企业营收',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#corporate-revenue").val(seachArr.toString());
                }
            })
        });
    }

    //纳税等级
    function tax_bracket(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.tax_bracket|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#taxBracketList',
                tips: '请选择纳税等级',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#tax-bracket").val(seachArr.toString());
                }
            })
        });
    }

    //用工人数
    function workers_number(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.workers_number|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#workersNumberList',
                tips: '请选择用工人数',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#workers-number").val(seachArr.toString());
                }
            })
        });
    }

    //研发投入占比
    function develop_proportion(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.develop_proportion|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#developProportionList',
                tips: '请选择研发投入占比',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#develop-proportion").val(seachArr.toString());
                }
            })
        });
    }

    //发明专利数量
    function patent_number(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.patent_number|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#patentNumberList',
                tips: '请选择发明专利数量',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#patent-number").val(seachArr.toString());
                }
            })
        });
    }

    //软著数量
    function soft_quantity(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.soft_quantity|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#softQuantityList',
                tips: '请选择软著数量',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#soft-quantity").val(seachArr.toString());
                }
            })
        });
    }

    //技术资质
    function technical_qualifications(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.technical_qualifications|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#technicalQualificationsList',
                tips: '请选择技术资质',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#technical-qualifications").val(seachArr.toString());
                }
            })
        });
    }

    //产业链角色
    function industrial_chain_role(params) {
        layui.use('xmSelect', function () {
            let data = [];
            params.forEach(function (item) {
                let ids = "{$vo.extension.industrial_chain_role|default=''}".split(',');
                if (ids.length && ids.findIndex(it => it == item.id) != -1) {
                    data.push({name: item.value, value: item.id, selected: true});
                } else {
                    data.push({name: item.value, value: item.id});
                }
            });
            xmSelect.render({
                el: '#industrialChainRoleList',
                tips: '请选择产业链角色',//选项提示文字
                filterable: true,//搜索模式
                data: data,
                on: function (item) {
                    let selectArr = item.arr;
                    let seachArr = [];
                    for (let j = 0; j < selectArr.length; j++) {
                        seachArr.push(selectArr[j].value)
                    }
                    $("#industrial-chain-role").val(seachArr.toString());
                }
            })
        });
    }
</script>
{/block}
